# Reproduction files - Validation JR

# Deepening Bridging and Moving Minds in Stressful Times







# Session Information -----------------------------------------------------




#R version 4.3.2 (2023-10-31 ucrt)
#Platform: x86_64-w64-mingw32/x64 (64-bit)
#Running under: Windows 10 x64 (build 19045)
#
#Matrix products: default
#
#locale:
#  [1] LC_COLLATE=German_Germany.utf8  LC_CTYPE=German_Germany.utf8    LC_MONETARY=German_Germany.utf8 LC_NUMERIC=C                   
#[5] LC_TIME=German_Germany.utf8    
#
#attached base packages:
#  [1] stats     graphics  grDevices utils     datasets  methods   base     
#
#other attached packages:
#  [1] readxl_1.4.2    forcats_1.0.0   stringr_1.5.0   dplyr_1.1.4     purrr_1.0.1     readr_2.1.4     tidyr_1.3.0     tibble_3.2.1   
#[9] ggplot2_3.5.1   tidyverse_1.3.2
#
#loaded via a namespace (and not attached):
#  [1] Rcpp_1.0.10         lubridate_1.9.2     mvtnorm_1.1-3       lattice_0.20-45     class_7.3-20        assertthat_0.2.1    psych_2.2.9        
#[8] R6_2.5.1            cellranger_1.1.0    backports_1.4.1     reprex_2.0.2        rootSolve_1.8.2.3   e1071_1.7-13        httr_1.4.4         
#[15] pillar_1.10.1       rlang_1.1.4         Exact_3.2           googlesheets4_1.0.1 rstudioapi_0.14     data.table_1.14.6   car_3.1-1          
#[22] Matrix_1.5-1        googledrive_2.0.0   munsell_0.5.0       proxy_0.4-27        broom_1.0.3         compiler_4.2.2      modelr_0.1.10      
#[29] pkgconfig_2.0.3     mnormt_2.1.1        DescTools_0.99.50   tidyselect_1.2.0    lmom_2.9            expm_0.999-7        crayon_1.5.2       
#[36] tzdb_0.3.0          dbplyr_2.3.0        withr_2.5.0         ggpubr_0.6.0        MASS_7.3-58.1       grid_4.2.2          nlme_3.1-160       
#[43] jsonlite_1.8.4      gtable_0.3.1        lifecycle_1.0.3     DBI_1.1.3           magrittr_2.0.3      scales_1.3.0        gld_2.6.6          
#[50] stringi_1.7.12      cli_3.6.0           carData_3.0-5       ggsignif_0.6.4      fs_1.6.1            xml2_1.3.3          ellipsis_0.3.2     
#[57] generics_0.1.3      vctrs_0.6.5         boot_1.3-28         tools_4.2.2         glue_1.6.2          hms_1.1.2           abind_1.4-5        
#[64] parallel_4.2.2      timechange_0.2.0    colorspace_2.1-0    gargle_1.3.0        rvest_1.0.3         rstatix_0.7.2       haven_2.5.3 



# Calculations ------------------------------------------------------------



library(tidyverse)
library(readxl)
library(stringr)



de_data <- readRDS("data_de_wght.RDS")


de_data <- de_data %>% 
  select(id, rj_codes)



zufallssampleCodiert <- read_excel("arguments_coded.xlsx", sheet = "Coded")
# count number of reasons




zufallssampleCodiert$reasons_N <- str_count(zufallssampleCodiert$Reasons, "\\S+")
zufallssampleCodiert[is.na(zufallssampleCodiert$reasons_N), ]$reasons_N <- 0



merged <- left_join(zufallssampleCodiert, de_data)





ggplot(merged, aes(reasons_N, rj_codes))+
  geom_jitter()+
  ggpubr::stat_cor(method = "spearman")+
  xlab("Number of unique arguments per statement")+
  ylab("Justification Rationality")+
  theme_bw()

ggsave("correlation_arguments_jr.png")


cor.test(merged$reasons_N, merged$rj_codes, method = "spearman")

